{% extends "master.html" %}
{% block head %}
  <meta http-equiv="Expires" CONTENT="0">
  <meta http-equiv="Cache-Control" CONTENT="no-cache">
  <meta http-equiv="Pragma" CONTENT="no-cache">
{% endblock %}
{% block scripts %}
<script src="/public/scripts/ViewMessagesByTopic.js"></script>
{% endblock %}

{% block breadcrumb %}
    <ul id="breadcrumb">
        <li><a href="/group/" title="Home"><img src="/public/images/home.png" alt="Home" class="home" /></a></li>
        <li><a href="/group/{{group.key.id}}">{{group.title}}</a></li>
        <li>{{topic.topic}}</li>
    </ul>
{% endblock %}
{% block content %}
<br>
<h1 class="headlineText">{{topic.topic}}</h1>

<div class="new">
    <a href="/newmessage/{{topic.key.id}}" class="button"><span>
    <img src="/public/images/plus.png" width="13" height="13" /> Message</span></a>
</div>

<div id="selectchecked">
    Select: 
    <select id="checkuncheck">
        <option value="All">All</option>
        <option value="None" selected="selected">None</option>
        <option value="Read">Read</option>
        <option value="Unread">Unread</option>
        <option value="Important">Important</option>
        <option value="Unimportant">Unimportant</option>
    </select>
    <div id="markread">Mark Read</div>
    <div id="markunread">Mark Unread</div>
</div>
{% for message in messages %}
{% if message.read %}
    <div class="message read">
{% else %}
    <div class="message">
{% endif %}
    <input type="checkbox" name="{{message.message.key.id}}"/>
    {% if message.important %}
        <span title="/important/{{message.message.key.id}}" class="check active" >✓</span>
    {% else %}
        <span title="/important/{{message.message.key.id}}" class="check">✓</span>
    {% endif %}
		<a href="/message/{{message.message.key.id}}"><h2>{{message.message.subject}}</h2></a>
		<div class="numReplies_fright">
		{{message.count}} replies
		</div>
		  <a href="/modifymessage/{{message.message.key.id}}" class="options">
           Modify
      </a>
      {% if moderator %}
        <a href="/deletemessage/{{message.message.key.id}}" class="options">
          Delete
        </a>
      {% endif %}
        
		<div class="user_fright">
			<a href="/viewprofile/{{message.author.key.id}}" class="displayname">{{message.author.displayname}}</a>
			<span>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			</span>
		</div>
    </div>
{% endfor %}
<!--<div class="newMessageButton fright">
    <a href="/newmessage/{{topic.key.id}}">New Post</a>
</div>-->
{% endblock %}
